package yu.hang.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import yu.hang.service.RoleService;

/**
 * Created by Astro on 2019/1/20.
 */
@Controller
public class ViewController {

    @Autowired
    RoleService roleService;

    @RequestMapping(value = "/home", method = RequestMethod.GET)
    public String home(Model model) {
        model.addAttribute("name", "test");
        return "index";
    }

    @ResponseBody
    @RequestMapping(value = "/test", method = RequestMethod.GET)
    public Object home() {
        return roleService.getBasDict();
    }
}
